package xhwl.hmo.mall.http.api;

import com.google.gson.Gson;

import okhttp3.RequestBody;
import rx.Observable;
import xhwl.hmo.mall.Constant;
import xhwl.hmo.mall.http.ApiService;
import xhwl.hmo.mall.http.bean.req.WxPrepayidReq;
import xhwl.retrofitrx.BaseApi;

/**
 * Created by admin on 2017-11-03.
 */

public class WXPrepayidApi extends BaseApi {
    WxPrepayidReq req;
    public WXPrepayidApi(String orderId,String ip){
        req=new WxPrepayidReq();
        req.setAppid(Constant.APP_ID);
        req.setMchid(Constant.MCH_ID);
        req.setIp(ip);
        req.setOrderid(orderId);
        setShowDialog(true);
    }
    @Override
    protected Observable getObservable() {
        RequestBody requestBody = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(req));
        return retrofit.create(ApiService.class).getWeixinpayPreid(requestBody);
    }
}
